package com.sto.stoapp.manager;

import android.content.Context;
import android.telephony.TelephonyManager;

/**
 * SIM工具类
 * 
 * @author Administrator
 * 
 */
public class SimCardManager {
	private TelephonyManager tm;

	private static SimCardManager simCardManager;

	public SimCardManager(Context context) {
		tm = (TelephonyManager) context
				.getSystemService(Context.TELEPHONY_SERVICE);
	}

	/**
	 * 得到单例化对象
	 * 
	 * @param context
	 * @return
	 */
	public static SimCardManager getInstance(Context context) {
		if (simCardManager == null) {
			simCardManager = new SimCardManager(context);
		}
		return simCardManager;
	}

	// sim是否存在
	public boolean isCanUseSim() {
		try {
			return TelephonyManager.SIM_STATE_READY == tm.getSimState();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
}
